package com.fashion.model.gallery;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.struts2.json.annotations.JSON;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name="FASHION.NEWSCOLUMN")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class GalleryColumn {
	@Id 
	@Column(name="ID", updatable=false)
	private String id;
	@Column(name="NAME")
	private String name;
	@Column(name="PARENTID")
	private String parentId;
	@Column(name="CREATEDATETIME")
	private Date date;
	@OneToMany(targetEntity=Album.class, mappedBy = "column", fetch=FetchType.LAZY)
	private List<Album> albumList; 
	@Transient
	private List<GalleryColumn> children = new ArrayList<GalleryColumn>();

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}
	
	@JSON(serialize = false)
	public List<Album> getAlbumList() {
		return albumList;
	}

	public void setAlbumList(List<Album> albumList) {
		this.albumList = albumList;
	}

	public List<GalleryColumn> getChildren() {
		return children;
	}

	public void setChildren(List<GalleryColumn> children) {
		this.children = children;
	}

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }
	
	
}
